package com.dfrz.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dfrz.entity.History;
import com.dfrz.entity.MyCollection;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 29877
 */
@Mapper
public interface HistoryMapper extends BaseMapper<History> {

    List<History> getHistory(Integer uid);

    History getDetailTypeAndImg(Integer videoId);

    @Insert("insert into history(user_id,video_id,history_time) values(#{uid},#{vid},#{time})")
    void addhistory(@Param("uid") Integer uid,@Param("vid") Integer vid,@Param("time") String time);

    //通过uid和vid删除历史记录
    @Delete("delete from history where user_id=#{uid} and video_id=#{vid}")
    void  deleteHistorybyUidAndVid(@Param("uid") Integer uid,@Param("vid") Integer vid);

    //通过history_id删除历史记录
    @Delete("delete from history where history_id=#{hid}")
    void deletehistorybyid(Integer hid);
    @Delete("delete from history where user_id=#{uid}")
    void deletehistorybyuid(Integer uid);
}
